<extend name="./public/frame.html"/>
<block name="content">
    <form class="layui-form layui-form-pane1" method="post" enctype="multipart/form-data">
        <div class="layui-inline">
            <label class="layui-form-label" style="width: 200px;">推荐类型</label>
            <div class="layui-input-inline" style="padding-top:5px">
                <input type="radio" name="refereeType" value="1" title="用户" checked>
                <input type="radio" name="refereeType" value="2" title="司机">
            </div>
        </div>
        <div class="layui-inline">
          <label class="layui-form-label" style="width: 200px;">推荐人手机号</label>
          <div class="layui-input-inline" style="padding-top:5px">
            <input type="text" name="phone" id="phone" lay-verify="phone" placeholder="推荐人手机号" autocomplete="off" class="layui-input">
            <input type="hidden" name="uid" id="uid" value="{$uid}">
          </div>
        </div>
  <div class="layui-form-item" style="padding-top:5px;padding-left: 20px;">
    <div class="layui-input-block">
        <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
    </div>
  </div>
</form>
	<script>
		layui.use(['form'], function () {
            var form = layui.form;
            form.on('submit(*)', function(data){
                var phone = $("#phone").val();
                if(phone == ''){
                    layer.msg('推荐人手机号不能为空',{icon: 5});return false
                }
                $.ajax({
                    url:'{:url("/admin/User/referEdit")}',
                    async:true,
                    dataType:'json',
                    type:'POST',
                    data: $(data.form).serialize(),
                    success:function(res){
                        if(res.code==1){
                            layer.alert(res.msg, {icon: 6},function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                                //window.parent.location.reload()
                            });
                        }else{
                            layer.msg(res.msg,{icon: 5});
                        }
                    }
                });
                return false;
            });
		});
	</script>
</block>
